import React from 'react';

export default class ResultStat extends React.Component {
    constructor(props){
        super(props);
        this.state = {
            title: this.props.title,
            content: this.props.content,
            type: this.props.type
        }
    }
    render(){
        let ico = (type)=>{
            switch(type){
                case 0:
                    return {_cn:'success',_ico:'√'};
                    break;
                case 1:
                    return {_cn:'warning',_ico:'!'};
                    break;
                case 2:
                    return {_cn:'error',_ico:'×'};
                    break;
                default:
                    return {_cn:'normal',_ico:'...'};
            }
        }
        return (
            <div className={`result-stat ${ico(this.props.type)._cn}`}>
                <em>{ico(this.props.type)._ico}</em>
                <h2>{this.props.title}</h2>
                <p>{this.props.content}</p>
            </div>
        )
    }
}